package cx3k.GUI;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JTextArea;

public class ErrorFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextArea jta;
	
	public ErrorFrame() {
		this.setTitle("Error");
		this.setSize(400, 200);
		this.setResizable(false);
		
		this.jta = new JTextArea("The following errors were encountered.\n\n");
		this.add(jta);	
		
		//Center frame on screen
		Toolkit toolkit = this.getToolkit();
	    Dimension size = toolkit.getScreenSize();
	    this.setLocation(size.width/2 - getWidth()/2, size.height/2 - getHeight()/2);
	    
	}
	
	public void showFrame() {
		this.setVisible(true);
	}
	
	public void addErrorText(String error) {
		this.jta.append(error + "\n");
	}

}
